/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.izu.mytruco.game;

import com.izu.mytruco.deck.Card;
import com.izu.mytruco.service.ClientListener;
import com.izu.mytruco.service.CommunicatorClient;
import java.io.IOException;
import java.net.UnknownHostException;
import java.util.List;

/**
 *
 * @author Ademar
 */
public class Player implements ClientListener{

    protected String name;
    protected List<Card> cards;
    protected CommunicatorClient client;

    public Player(String name) throws UnknownHostException, IOException {
        this.name = name;
        this.client = new CommunicatorClient(this);
    }

    public void messageReceived(String message) {
        System.out.println("Client: " + message);
    }

    public void sendMessage(String message) throws IOException {
        client.sendMessage(message);
    }

    public Card getCard(Integer position) {
        return cards.get(position);
    }

    public static void main(String[]args) throws UnknownHostException, IOException{
        Player p = new Player("Ademar");
        System.out.println("INICIOU");
        p.sendMessage("TEST DE MESSAGE");
        System.out.println("MANDOU MSG");
    }
}
